Skip to content

Adds an spherical basis that is an exact deprojection of an exponential surface density#199

Merged
michael-petersen merged 48 commits into
develfrom
SphericalExact
Mar 23, 2026
Merged

Adds an spherical basis that is an exact deprojection of an exponential surface density#199
michael-petersen merged 48 commits into
develfrom
SphericalExact

Conversation

@The9Cat

@The9Cat The9Cat commented Feb 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds an spherical basis that is an exact deprojection of an exponential surface density. Specifically, using the Abel inversion, the exponential surface density
$$\qquad\Sigma(R)=\Sigma_0 e^{-R/a}$$
for $R>0$ deprojects to
$$\qquad\rho(r)=\frac{\Sigma_0}{\pi a} K_0\left(\frac{r}{a}\right).$$

Implementation

The exact deprojected spherical basis is the default in this branch and has the ascii tag ExpDeproj. The previous default was Exponential. The cumulative mass needed by SLGridSph is analytic but only in terms of modified Bessel and Struve functions. The latter is not available in the stdlib. The cumulative mass is computed using brute-force quadrature instead.

Note

I would recommend renaming ExpDeproj to Exponential and delete the older, original implementation. I've left both for testing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new spherical “exponential deprojection” density model (based on the Abel inversion / modified Bessel (K_0)) and wires it into the cylindrical EOF basis generation as the new default option, with an additional configurable scale-length bias factor and a small test driver.

Changes:

  • Introduces ExpDeproj profile implementation (density + tabulated enclosed-mass) and exposes it as a selectable EmpCylSL model (ExpSphere).
  • Switches the default spherical model for EmpCylSL EOF generation to the new deprojected exponential-sphere option and updates cache validation to include the model label.
  • Adds a bias configuration parameter to rescale the effective disk scale length used for basis construction; adds a testED executable.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
utils/Test/testED.cc Adds a small executable to numerically re-project the deprojected density and compare against an exponential surface density.
utils/Test/CMakeLists.txt Builds the new testED utility.
src/Cylinder.cc Adds bias config support and applies it to the scale length passed into the cylindrical basis constructor.
src/Cylinder.H Documents and stores the new bias parameter.
include/ExpDeproj.H Declares the new ExpDeproj profile helper.
include/EmpCylSL.H Adds ExpSphere to EmpModel and stores a precomputed ExpDeproj instance.
exputil/ExpDeproj.cc Implements ExpDeproj density and tabulated/interpolated enclosed mass.
exputil/EmpCylSL.cc Makes ExpSphere the default model, routes densR/massR to ExpDeproj, adds debug output, and tightens HDF5 cache validation via model.
exputil/CMakeLists.txt Compiles ExpDeproj.cc into exputil.
expui/BiorthBasis.cc Adds bias, changes default mtype, and expands mtype parsing to include the new model.
expui/BiorthBasis.H Stores the new bias parameter in the cylindrical basis configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread exputil/ExpDeproj.cc Outdated
Comment thread exputil/ExpDeproj.cc Outdated
Comment thread exputil/ExpDeproj.cc
Comment thread utils/Test/testED.cc
Comment thread src/Cylinder.cc
Comment thread expui/BiorthBasis.cc
Comment thread expui/BiorthBasis.cc

Copilot AI commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #201, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #202, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #203, to work on those changes. Once the pull request is ready, I'll request review from you.

michael-petersen and others added 7 commits February 17, 2026 11:05
- Revert EmpCylSL::mtype default to Exponential
- Add user info message suggesting using ExpSphere instead
- Add mtype key to Cylindrical
- Add new ExpSphere types to IC utilities
- Add a list of allowed mtypes for Doxygen documenation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

utils/ICs/check_coefs.cc:497

  • The error message in check_coefs.cc still lists the outdated options and is missing ExpSphere and Power from the list. The updated list should match what's shown in check_coefs2.cc line 500: "Exponential, ExpSphere, Gaussian, Plummer, Power".
      if (myid==0) std::cout << "No EmpCylSL EmpModel named <"
			     << mtype << ">, valid types are: "
			     << "Exponential, Gaussian, Plummer" << std::endl;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Cylinder.H
Comment thread utils/ICs/check_coefs.cc
Comment thread utils/ICs/check_coefs.cc Outdated
Comment thread utils/ICs/check_coefs2.cc Outdated
Comment thread exputil/ExpDeproj.cc Outdated

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #205, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #206, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@The9Cat I've opened a new pull request, #207, to work on those changes. Once the pull request is ready, I'll request review from you.

@michael-petersen

Copy link
Copy Markdown
Member

I've been using this for standard usage and have had no problems, so I'll merge it into devel.

@michael-petersen michael-petersen merged commit 20a863e into devel Mar 23, 2026
8 checks passed
@michael-petersen michael-petersen deleted the SphericalExact branch March 23, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants